import http from '@src/util/http'
import { disposeTaskSearchModelDate } from './TaskApi'
let prefix = '/api/callcenter'

/**
 * 开通申请
 * @param {*} params 
 */
export function saveAccount(params) {
  return http.post(`${prefix}/outside/callcenter/api/saveAccount`, params, false)
}

/**
 * 获取是否申请开通
 * @param {*} params 
 */
export function getAccountInfo(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getAccountInfo`, params)
}

/**
 * 添加成员
 * @param {*} params 
 */
export function saveAgent(params) {
  return http.post(`${prefix}/outside/callcenter/api/saveAgent`, params, false)
}

/**
 * 获取坐席列表
 * @param {*} params 
 */
export function getAgentList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getAgentList`, params)
}

/**
 * 坐席修改提交
 * @param {*} params 
 */
export function updateAgent(params) {
  return http.post(`${prefix}/outside/callcenter/api/updateAgent`, params, false)
}

/**
 * 坐席删除
 * @param {*} params 
 */
export function deleteAgent(params) {
  return http.post(`${prefix}/outside/callcenter/api/deleteAgent`, params, false)
}

/**
 * 坐席开关
 * @param {*} params 
 */
export function updateStatus(params) {
  return http.post(`${prefix}/outside/callcenter/api/updateStatus`, params, false)
}

/**
 * 添加/修改一级/二级分类
 * @param {*} params 
 */
export function saveZxSort(params) {
  return http.post(`${prefix}/outside/callcenter/api/saveZxSort`, params, false)
}

/**
 * 获取咨询分类列表
 * @param {*} params 
 */
export function getZxSortList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getZxSortList`, params)
}

/**
 * 删除咨询分类
 * @param {*} params 
 */
export function deleteZxSort(params) {
  return http.post(`${prefix}/outside/callcenter/api/deleteZxSort`, params, false)
}

/**
 * 服务备注列表
 * @param {*} params 
 */
export function getFwRemarkList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getFwRemarkList`, params)
}

/**
 * 添加服务备注
 * @param {*} params 
 */
export function saveFwRemark(params) {
  return http.post(`${prefix}/outside/callcenter/api/saveFwRemark`, params, false)
}

/**
 * 删除服务备注
 * @param {*} params 
 */
export function deleteFwRemark(params) {
  return http.post(`${prefix}/outside/callcenter/api/deleteFwRemark`, params, false)
}

/**
 * 今日通话记录
 * @param {*} params 
 */
export function getTodayCallRecordList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getTodayCallRecordList`, params)
}

/**
 * 智齿今日通话记录
 * @param {*} params 
 */
export function getZhiChiTodayCallRecordList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/zhichi/getTodayCallRecordList`, params)
}

/**
 * 来电消息--联系人信息
 * @param {*} params 
 */
export function getLinkmanInfo(params = {}) {
  return http.get('/customer/detail4CallCenterTab', params)
}

/**
 * 来电弹屏--服务备注--客户信息
 * @param {*} params 
 */
export function getCustomerInfo(params = {}) {
  return http.get(`${prefix}/outside/callcenter/ext/detail4CallCenterRemark`, params)
  // return http.get('/customer/detail4CallCenterRemark', params)
}

/**
 * 来电弹屏--服务备注--客户信息
 * @param {*} params 
 */
export function getZhiChiCustomerInfo(params = {}) {
  return http.get(`${prefix}/outside/callcenter/zhichi/detail4CallCenterRemark`, params)
}

/**
 * 服务记录--历史通话
 * @param {*} params 
 */
export function getHistoryCallRecordList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getHistoryCallRecordList`, params)
}

/**
 * 服务记录--历史通话
 * @param {*} params 
 */
export function getZhiChiHistoryCallRecordList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/zhichi/getHistoryCallRecordList`, params)
}

/**
 * 删除今日通话记录
 * @param {*} params 
 */
export function deleteTodayCallRecord(params = {}) {
  return http.post(`${prefix}/outside/callcenter/api/deleteTodayCallRecord`, params, false)
}

/**
 * 服务记录--历史工单
 * @param {*} params 
 */
export function getTaskHistoryList(params = {}) {
  disposeTaskSearchModelDate(params)
  return http.post(`/task/list4CallCenterHistory?linkmanPhone=${params.linkmanPhone}`, params)
}

/**
 * 呼叫中心状态
 * @param {*} params 
 */
export function getTodayCallState(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getTodayCallState`, params)
}

/**
 * 今日统计
 * @param {*} params 
 */
export function getTodayStatisticsRecord(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getTodayStatisticsRecord`, params)
}

/**
 * 通话记录
 * @param {*} params 
 */
export function getRecordList(params = {}) {
  return http.post(`${prefix}/outside/callcenter/api/recordList`, params)
}

/**
 * 智齿通话记录
 * @param {*} params 
 */
export function getZhiChiRecordList(params = {}) {
  return http.post(`${prefix}/outside/callcenter/zhichi/recordList`, params)
}

/**
 * 通话记录详情
 * @param {*} params 
 */
export function getCallRecord(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getCallRecord`, params)
}

/**
 * 智齿通话记录详情
 * @param {*} params 
 */
export function getZhiChiCallRecord(params = {}) {
  return http.get(`${prefix}/outside/callcenter/zhichi/getCallRecord`, params)
}

/**
 * 类型呼出
 * @param {*} params 
 */
export function dialout(params = {}) {
  return http.post(`${prefix}/outside/callcenter/api/dialout`, params, false)
}

/**
 * 未接来电修改处理状态
 * @param {*} params 
 */
export function updateHandleStatus(params = {}) {
  return http.post(`${prefix}/outside/callcenter/api/updateHandleStatus`, params, false)
}

/**
 * 获取今日该号码来电数和归属地
 * @param {*} params 
 */
export function getTodayNormalCount(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getTodayNormalCount`)
}

/**
 * 通话挂断
 * @param {*} params 
 */
export function hangUpCall(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/hangUpCall`)
}



/**
 * 坐席列表V2
 * @param {*} params 
 */
export function getTechList(params = {}) {
  return http.get(`${prefix}/outside/callcenter/api/getAgentList/v2`)
}

/**
 * 坐席绑定
 * @param {*} params 
 */
export function lockTech(params = {}) {
  return http.post(`${prefix}/outside/callcenter/api/agent/bind`, params, false)
}

/**
 * 坐席解绑
 * @param {*} params 
 */
export function unlockTech(params = {}) {
  return http.post(`${prefix}/outside/callcenter/api/agent/unbind`, params, false)
}

// 对接中通天鸿 后台接口--start
/**
 * 获取中通天鸿token
 * @param {*} params 
 */
export function agentGetToken(params) {
  return http.get(`${prefix}/outside/callcenter/api/agent/token/get`, params, false)
}

/**
 * 中通天鸿sdk ws 信息发送到后台
 * @param {*} params 
 */
export function agentReceiveMsg(params) {
  return http.post(`${prefix}/outside/callcenter/api/agent/message/receive`, params)
}

/**
 * 获取联系人信息
 * @param {*} params 
 */
export function agentGetLinkmanInfo(params) {
  return http.get(`${prefix}/outside/callcenter/api/agent/linkman/get`, params)
}

/**
 * 获取剩余话费
 * @param {*} params 
 */
export function agentGetCost(params) {
  return http.get(`${prefix}/outside/callcenter/api/agent/cost/get`, params)
}
// 对接中通天鸿 后台接口--end

/**
 * 修改坐席状态
 * @param {*} params 
 */
export function agentStatusUpdate(params) {
  return http.post(`${prefix}/outside/callcenter/api/agentStatusUpdate`, params)
}

/**
 * 设置坐席的转接手机号
 * @param {*} params 
 */
export function updateTransferPhone(params) {
  return http.post(`${prefix}/outside/callcenter/api/updateTransferPhone`, params)
}

/**
 * 查询坐席的转接手机号
 * @param {*} params 
 */
export function queryTransferPhone(params) {
  return http.get(`${prefix}/outside/callcenter/api/queryTransferPhone`, params)
}

/**
 * @description 创建智齿通话记录
 */
export function zhiChiCallCenterRecord(params) {
  return http.post(`${prefix}/outside/callcenter/zhichi/createRecord`, params)
}

/**
 * @description 获取呼叫中心配置
 */
export function getCallCenterAccountInfoUpdate(params) {
  return http.get(`${prefix}/outside/callcenter/zhichi/getAccountInfoUpdate`, params)
}

/**
 * @description 获取坐席接听方式
 */
 export function queryAgentUserType(params) {
  return http.get(`${prefix}/outside/callcenter/api/queryAgentUserType`, params)
}

/**
 * @description 获取坐席列表状态
 */
 export function getAgentMonitor(params) {
  return http.get(`${prefix}/outside/callcenter/api/getAgentMonitor`, params)
 }

 /**
 * 通话中查询客户信息
 * @param {*} params 
 */
 export function detail4Call2CenterRemark(params = {}) {
  return http.get(`${prefix}/outside/callcenter/zhichi/detail4Call2CenterRemark`, params)
}

/**
 * @description 切换客户
 */
export function callCenterRemarkInfo(params) {
  return http.post(`${prefix}/outside/callcenter/ext/callCenterRemarkInfo`, params)
}

/**
 * @description 设置离线转接开关
 */
export function offLineAnswer(params) {
  return http.post(`${prefix}/outside/callcenter/callcenteragent/offLineAnswer`, params)
}

/**
 * 关联通话记录和产品 POST
 * @param {Object} params
 * @param {String} params params.recordId - 通话ID
 * @param {String} params params.productIds - 关联产品信息
 * 
 */
export function addCallRecordAndProducts (params) {
  return http.post(`/api/callcenter/outside/callcenter/api/addCallRecordAndProducts`,params);
}
